/**
 * 
 */
package application;

import guis.MainFormControl;
import guis.TrayIcon;

import org.eclipse.swt.events.ShellAdapter;
import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

/**
 * @author kest
 * 
 */
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		Factory.getLogger().trace("Starting...");

		// create tray icon
		final Display display = new Display();
		final Shell shell = new Shell(display);

		final TrayIcon icon = new TrayIcon(display, shell);

		icon.Show_Noinify("Hey!!");

		// gui controller

		shell.addShellListener(new ShellAdapter() {
			@Override
			public void shellActivated(ShellEvent e) {
				@SuppressWarnings("unused")
				MainFormControl guiControl = new MainFormControl(shell);
			}
		});

		// set timers

		// Create and check the event loop
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		display.dispose();
		Factory.getLogger().trace("Exiting...");
	}

}
